using System.Collections.Generic;

public class Table_MissionItem : IDataItem
{
	/// <summary>
	/// 唯一ID
	/// <summary>
	public int Id { get; private set; }
	/// <summary>
	/// 任务标题
	/// <summary>
	public string Title { get; private set; }
	/// <summary>
	/// 任务描述
	/// <summary>
	public string Desc { get; private set; }
	/// <summary>
	/// 任务图标
	/// <summary>
	public string Icon { get; private set; }
	/// <summary>
	/// 图标图集
	/// <summary>
	public string Atlas { get; private set; }
	/// <summary>
	/// 任务类型
	/// <summary>
	public int TaskType { get; private set; }
	/// <summary>
	/// 功能点类型
	/// <summary>
	public int FuncType { get; private set; }
	/// <summary>
	/// 功能点数量
	/// <summary>
	public int FuncNum { get; private set; }
	/// <summary>
	/// 后置任务id
	/// <summary>
	public int NextId { get; private set; }
	/// <summary>
	/// 跳转界面id
	/// <summary>
	public int GetUIdCount() { return UId.Count; }
	private List<int> UId = new List<int>();
	public int GetUIdByIndex(int idx)
	{
		return UId.GetValueByIdx(idx, 0);
	}
	/// <summary>
	/// 优先级
	/// <summary>
	public int SortId { get; private set; }
	/// <summary>
	/// 奖励类型
	/// <summary>
	public int AwardType { get; private set; }
	/// <summary>
	/// 奖励
	/// <summary>
	public int GetAwardCount() { return Award.Count; }
	private List<int> Award = new List<int>();
	public int GetAwardByIndex(int idx)
	{
		return Award.GetValueByIdx(idx, 0);
	}
	/// <summary>
	/// 客户端显示类型
	/// <summary>
	public int ShowType { get; private set; }
	/// <summary>
	/// 完成后处理
	/// <summary>
	public int Finish { get; private set; }

	public Table_MissionItem(ExcelLineReader reader)
	{
		Id = reader.ReadInt();
		Title = reader.ReadString();
		Desc = reader.ReadString();
		Icon = reader.ReadString();
		Atlas = reader.ReadString();
		TaskType = reader.ReadInt();
		FuncType = reader.ReadInt();
		FuncNum = reader.ReadInt();
		NextId = reader.ReadInt();
		UId = reader.ReadShortString().ToIntList();
		SortId = reader.ReadInt();
		AwardType = reader.ReadInt();
		Award = reader.ReadShortString().ToIntList();
		ShowType = reader.ReadInt();
		Finish = reader.ReadInt();
	}
}

public class Table_MissionMgr : IDataMgr
{
	protected override string FileName { get { return "Txt/Mission.txt"; } }

	protected Dictionary<int, int> mItemDic = new Dictionary<int, int>();
	public int GetIdxById(int key) { return mItemDic[key]; }

	public override void Load(ExcelLineReader reader)
	{
		var item = new Table_MissionItem(reader);
		mItemDic[item.Id] = DataCount;
		mItemList.Add(item);
	}

	public Table_MissionItem GetItemByIdx(int idx)
	{
		return GetItemByIdx<Table_MissionItem>(idx);
	}

	public Table_MissionItem GetItemById(int id)
	{
		int idx = GetIdxById(id);
		return GetItemByIdx(idx);
	}
}